package cn.tedu.finance.controller;

import cn.tedu.base.response.JsonResult;
import cn.tedu.finance.pojo.dto.PurchaseQueryParam;
import cn.tedu.finance.pojo.dto.PurchaseSaveParam;
import cn.tedu.finance.pojo.vo.PurchaseVO;
import cn.tedu.finance.service.PurchaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/purchaseApplication")
public class PurchaseController {
    @Autowired
    private PurchaseService purchaseService;
    @GetMapping("select")
    public JsonResult select (PurchaseQueryParam purchaseQueryParam){
        log.debug("这是查询数据的第一次出现"+purchaseQueryParam);
        List<PurchaseVO> list=purchaseService.select(purchaseQueryParam);
        log.debug("回去的路222222222222222222222222222----------------------------------------"+list);
        return JsonResult.ok(list);
    }


    @PostMapping("save")
    public  JsonResult save (@RequestBody PurchaseSaveParam purchaseSaveParam){
        log.debug("这是保存数据的第一次出现"+purchaseSaveParam);
        purchaseService.save(purchaseSaveParam);
        return JsonResult.ok();
    }
}
